home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / enemy / BugB.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  24.3 KB  |  806 lines

  1. class classes.enemy.BugB
  2. {
  3.    var x;
  4.    var y;
  5.    var moveScript;
  6.    var matrixCoords;
  7.    var form;
  8.    var id;
  9.    var clip;
  10.    var colorR;
  11.    var trans;
  12.    var colorTrans;
  13.    var advanceMax;
  14.    var advanceMax2;
  15.    var matrixVar;
  16.    var dir;
  17.    var f2;
  18.    var scc;
  19.    var axis;
  20.    var switchDir;
  21.    var sfc;
  22.    var sfMax;
  23.    var xDest;
  24.    var yDest;
  25.    var oldDir;
  26.    var firing;
  27.    var fc;
  28.    var xMov = 0;
  29.    var yMov = 0;
  30.    var xmt = 0;
  31.    var ymt = 0;
  32.    var xMovT = 0;
  33.    var yMovT = 0;
  34.    var speedOrig = 9;
  35.    var speed = 9;
  36.    var xDestMet = false;
  37.    var yDestMet = false;
  38.    var c = 0;
  39.    var feelerInfo = [[-400,0,400,40],[0,0,400,40],[0,-400,40,400],[0,0,40,400]];
  40.    var dirArray = ["L","R","U","D"];
  41.    var pUp = false;
  42.    var life = 12;
  43.    var nudging = false;
  44.    var nc = 0;
  45.    var xA = 0;
  46.    var yA = 0;
  47.    var power = 30;
  48.    var Name = "bugB";
  49.    function BugB(px, py, pmoveScript, pmatrixCoords, pform, pid)
  50.    {
  51.       this.x = px;
  52.       this.y = py;
  53.       this.moveScript = pmoveScript.slice();
  54.       this.matrixCoords = pmatrixCoords.slice();
  55.       this.form = pform.slice();
  56.       this.id = pid;
  57.       _root.d = _root.d + 1;
  58.       this.clip = _root.attachMovie("bugB","bugB" + this.id + "Clip",_root.d + 50000);
  59.       this.clip._x = this.x;
  60.       this.clip._y = this.y;
  61.       this.speed *= _root.dif.speed;
  62.       this.speedOrig = this.speed;
  63.       this.life *= _root.dif.life;
  64.       this.colorR = _root.randRange(-30,30);
  65.       this.trans = new flash.geom.Transform(this.clip);
  66.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,this.colorR,this.colorR,this.colorR,0);
  67.       this.trans.colorTransform = this.colorTrans;
  68.       this.advanceMax = 60 / (this.speed / 2);
  69.       this.advanceMax2 = 50 / (this.speed / 2);
  70.       if(this.matrixCoords[0] == "free")
  71.       {
  72.          this.matrixVar = 0;
  73.       }
  74.       else
  75.       {
  76.          this.matrixVar = 1;
  77.       }
  78.       this.speedVar();
  79.       if(random(100) > 92)
  80.       {
  81.          this.pUp = true;
  82.       }
  83.       this.clip.body.eye2.eye.gotoAndPlay(10);
  84.       this.clip.body.eye3.eye.gotoAndPlay(20);
  85.       this.parseMoveScript();
  86.       _root.stats.created = _root.stats.created + 1;
  87.    }
  88.    function broBehind()
  89.    {
  90.       this.dir = _root.advanceDir;
  91.    }
  92.    function bombed(num)
  93.    {
  94.       this.f2 = "death";
  95.    }
  96.    function switchScope()
  97.    {
  98.       this.scc = 0;
  99.       this.getDirString();
  100.       this.f2 = "switchScoping";
  101.       this.c = 5;
  102.       this.speed /= 2;
  103.       this[this.axis + "MovT"] /= 2;
  104.       this.clip.body.flame.gotoAndStop("still");
  105.       _root.audio.playLevel2("bugBSwitch",_root.randRange(8,15));
  106.    }
  107.    function switchScoping()
  108.    {
  109.       this.c = this.c + 1;
  110.       if(this.c == 10)
  111.       {
  112.          this.scc = this.scc + 1;
  113.          this.c = 0;
  114.          if(this.dir == "U" || this.dir == "D")
  115.          {
  116.             _root.d = _root.d + 1;
  117.             _root.attachMovie("sight","sightClip",_root.d);
  118.             _root.sightClip.gotoAndStop("bugASwitchFire");
  119.             _root.sightClip._x = this.x;
  120.             _root.sightClip._y = this.y;
  121.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  122.             {
  123.                this.switchFire("L");
  124.             }
  125.             else
  126.             {
  127.                _root.sightClip._rotation = 180;
  128.                if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  129.                {
  130.                   this.switchFire("R");
  131.                }
  132.             }
  133.             removeMovieClip(_root.sightClip);
  134.          }
  135.          else
  136.          {
  137.             _root.d = _root.d + 1;
  138.             _root.attachMovie("sight","sightClip",_root.d);
  139.             _root.sightClip.gotoAndStop("bugASwitchFire");
  140.             _root.sightClip._x = this.x;
  141.             _root.sightClip._y = this.y;
  142.             _root.sightClip._rotation = 90;
  143.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  144.             {
  145.                this.switchFire("U");
  146.             }
  147.             else
  148.             {
  149.                _root.sightClip._rotation = -90;
  150.                if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  151.                {
  152.                   this.switchFire("D");
  153.                }
  154.             }
  155.             removeMovieClip(_root.sightClip);
  156.          }
  157.          if(this.scc > _root.randRange(9,12))
  158.          {
  159.             this.clip.body.gotoAndStop("main");
  160.             this.speed = this.speedOrig;
  161.             this[this.axis + "MovT"] *= 2;
  162.             this.clip.body.flame.gotoAndPlay("start");
  163.             this.f2 = "wander";
  164.          }
  165.       }
  166.    }
  167.    function switchFire(tmpDir)
  168.    {
  169.       this.clip.gotoAndStop("fly" + tmpDir);
  170.       this.switchDir = tmpDir;
  171.       this.c = 0;
  172.       this.sfc = 0;
  173.       this.f2 = "switchFiring";
  174.       this.sfMax = _root.randRange(1,4);
  175.    }
  176.    function switchFireBlast()
  177.    {
  178.       this.clip.body.gotoAndPlay("switchFire");
  179.       if(this.switchDir == "L")
  180.       {
  181.          var _loc3_ = this.x - 24;
  182.          var _loc4_ = this.dir != "U" ? this.y + 21 : this.y + 3;
  183.       }
  184.       else if(this.switchDir == "R")
  185.       {
  186.          _loc3_ = this.x + 9;
  187.          _loc4_ = this.dir != "U" ? this.y + 21 : this.y + 3;
  188.       }
  189.       else if(this.switchDir == "U")
  190.       {
  191.          _loc3_ = this.dir != "L" ? this.x + 21 : this.x + 3;
  192.          _loc4_ = this.y - 36;
  193.       }
  194.       else
  195.       {
  196.          _loc3_ = this.dir != "L" ? this.x + 21 : this.x + 3;
  197.          _loc4_ = this.y + 15;
  198.       }
  199.       _root.enemyShotID = _root.enemyShotID + 1;
  200.       _root["bugASwitchBlast" + _root.enemyShotID] = new classes.shots.BugASwitchBlast(_loc3_,_loc4_,this.switchDir,_root.enemyShotID);
  201.       _root.addEnemyShot("bugASwitchBlast" + _root.enemyShotID);
  202.       _root.audio.playLevel3("bugBSwitchBlast" + (random(2) + 1),_root.randRange(15,25));
  203.    }
  204.    function switchFiring()
  205.    {
  206.       this.c = this.c + 1;
  207.       if(this.c == 10)
  208.       {
  209.          this.clip.body.gotoAndPlay("switch");
  210.       }
  211.       if(this.c == 17)
  212.       {
  213.          this.switchFireBlast();
  214.       }
  215.       if(this.c == 24)
  216.       {
  217.          this.switchFireBlast();
  218.          this.c = 18;
  219.          this.sfc = this.sfc + 1;
  220.          if(this.sfc == this.sfMax)
  221.          {
  222.             this.clip.body.gotoAndPlay("switchRev");
  223.             this.c = 33;
  224.          }
  225.       }
  226.       if(this.c == 45)
  227.       {
  228.          this.clip.gotoAndStop("fly" + this.dir);
  229.          this.clip.body.gotoAndStop("main");
  230.          this.speed = this.speedOrig;
  231.          this[this.axis + "MovT"] *= 2;
  232.          this.clip.body.flame.gotoAndPlay("start");
  233.       }
  234.    }
  235.    function nudge(pxA, pyA, pscale)
  236.    {
  237.       this.nc = 0;
  238.       this.nudging = true;
  239.       var _loc2_ = pscale / 100;
  240.       this.xA = pxA * _loc2_;
  241.       this.yA = pyA * _loc2_;
  242.    }
  243.    function speedVar()
  244.    {
  245.       if(random(3) == 1)
  246.       {
  247.          this.speed *= _root.randRange2(0.9999,1.0001);
  248.       }
  249.    }
  250.    function parseMoveScript()
  251.    {
  252.       this.dir = this.moveScript[0];
  253.       if(this.dir == "break")
  254.       {
  255.          delete this.moveScript;
  256.          if(this.matrixCoords[0] == "free")
  257.          {
  258.             if(random(2) == 1)
  259.             {
  260.                this.f2 = "wander";
  261.                this[this.axis + "MovT"] = 0;
  262.                this.axis = this.axis != "y" ? "y" : "x";
  263.                this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  264.                this.speedVar();
  265.                this.getDirString();
  266.             }
  267.             else
  268.             {
  269.                this.switchScope();
  270.             }
  271.          }
  272.          else
  273.          {
  274.             this[this.axis + "MovT"] = 0;
  275.             this.xDest = _root.advanceDir != "L" ? this.matrixCoords[0] * 60 : this.matrixCoords[0] * 60 + 320;
  276.             this.yDest = this.matrixCoords[1] * 50 + 10;
  277.             this.axis = Math.abs(this.xDest - this.x) <= Math.abs(this.yDest - this.y) ? "y" : "x";
  278.             this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
  279.             this.getDirString();
  280.             this.speedVar();
  281.             this.f2 = "gotoMatrix";
  282.          }
  283.       }
  284.       else
  285.       {
  286.          this[this.axis + "MovT"] = 0;
  287.          this.f2 = "gotoXYDest";
  288.          this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  289.          this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  290.          this.speedVar();
  291.          if(this.dir == "L" || this.dir == "U")
  292.          {
  293.             this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
  294.          }
  295.          else
  296.          {
  297.             this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
  298.          }
  299.          this.moveScript.splice(0,2);
  300.       }
  301.    }
  302.    function gotoXYDest()
  303.    {
  304.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  305.       {
  306.          if(this.axis == "x")
  307.          {
  308.             this.x = this.xDest;
  309.          }
  310.          else
  311.          {
  312.             this.y = this.yDest;
  313.          }
  314.          this.parseMoveScript();
  315.       }
  316.    }
  317.    function gotoMatrix()
  318.    {
  319.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  320.       {
  321.          if(this.axis == "x")
  322.          {
  323.             this.x = this.xDest;
  324.          }
  325.          else
  326.          {
  327.             this.y = this.yDest;
  328.          }
  329.          this[this.axis + "MovT"] = 0;
  330.          this.axis = this.axis != "x" ? "x" : "y";
  331.          this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
  332.          this.getDirString();
  333.          this.speed = this.speedOrig;
  334.       }
  335.       if(Math.abs(this.x - this.xDest) < this.speed + 1 && Math.abs(this.y - this.yDest) < this.speed + 1)
  336.       {
  337.          this.x = this.clip._x = this.xDest;
  338.          this.y = this.clip._y = this.yDest;
  339.          this.xMovT = this.xMov = 0;
  340.          this.yMovT = this.yMov = 0;
  341.          this.matrixVar = 2;
  342.          this.dir = _root.advanceDir;
  343.          this.clip.body.flame.gotoAndPlay("still");
  344.          _root.matrixNum = _root.matrixNum + 1;
  345.          if(_root.matrixNum >= _root.matrixSize)
  346.          {
  347.             _root.matrixComplete = true;
  348.          }
  349.          _root["formB" + this.form[0]] = "matrixed";
  350.          this.f2 = "wait";
  351.       }
  352.    }
  353.    function getDirString()
  354.    {
  355.       if(this.xMovT < -1)
  356.       {
  357.          this.dir = "L";
  358.       }
  359.       else if(this.xMovT > 1)
  360.       {
  361.          this.dir = "R";
  362.       }
  363.       else if(this.yMovT > 1)
  364.       {
  365.          this.dir = "D";
  366.       }
  367.       else if(this.yMovT < -1)
  368.       {
  369.          this.dir = "U";
  370.       }
  371.    }
  372.    function evade()
  373.    {
  374.       if(this.matrixVar == 2)
  375.       {
  376.          this.matrixVar = 0;
  377.          this.f2 = "wander";
  378.          this.axis = random(10) <= 4 ? "y" : "x";
  379.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  380.          this.speedVar();
  381.          this.getDirString();
  382.       }
  383.       else if(this.f2 == "wander")
  384.       {
  385.          this[this.axis + "MovT"] = 0;
  386.          this.axis = this.axis != "x" ? "x" : "y";
  387.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  388.          this.getDirString();
  389.       }
  390.    }
  391.    function wait()
  392.    {
  393.       if(random(1000) >= 998 + _root.dif.wait && _root.matrixComplete)
  394.       {
  395.          this.dir = this.findDir();
  396.          this.clip.body.flame.gotoAndPlay("start");
  397.          if(this.dir == _root.advanceDir)
  398.          {
  399.             this.matrixVar = 0;
  400.             this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
  401.             this.f2 = "attacking";
  402.          }
  403.          else if(this.dir == "U" || this.dir == "D")
  404.          {
  405.             this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  406.             this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  407.             this.matrixVar = 0;
  408.             this.c = 0;
  409.             this.f2 = "leavingMatrix";
  410.          }
  411.       }
  412.    }
  413.    function leavingMatrix()
  414.    {
  415.       this.c = this.c + 1;
  416.       if(this.c > this.advanceMax2)
  417.       {
  418.          this.c = 0;
  419.          this.dir = this.findDir();
  420.          if(this.dir == _root.advanceDir)
  421.          {
  422.             this.yMovT = 0;
  423.             this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
  424.             this.f2 = "attacking";
  425.          }
  426.       }
  427.    }
  428.    function findDir()
  429.    {
  430.       _root.d = _root.d + 1;
  431.       _root.attachMovie("feeler","feelerClip",_root.d);
  432.       var _loc7_ = [];
  433.       var _loc9_ = 0;
  434.       var _loc11_ = this.dirArray.length;
  435.       while(_loc9_ < _loc11_)
  436.       {
  437.          _root.feelerClip._x = this.x + this.feelerInfo[_loc9_][0];
  438.          _root.feelerClip._y = this.y + this.feelerInfo[_loc9_][1];
  439.          _root.feelerClip._width = this.feelerInfo[_loc9_][2];
  440.          _root.feelerClip._height = this.feelerInfo[_loc9_][3];
  441.          var _loc3_ = 0;
  442.          var _loc8_ = _root.chars.length;
  443.          var _loc6_ = false;
  444.          while(_loc3_ < _loc8_)
  445.          {
  446.             var _loc5_ = _root.chars[_loc3_] + "Clip";
  447.             if(_root.feelerClip.hitTest(_root[_loc5_]))
  448.             {
  449.                var _loc4_ = _root.chars[_loc3_];
  450.                if(_root[_loc4_].matrixVar == 2 && _loc4_ != this.Name + this.id)
  451.                {
  452.                   _loc6_ = true;
  453.                   break;
  454.                }
  455.             }
  456.             _loc3_ = _loc3_ + 1;
  457.          }
  458.          if(!_loc6_)
  459.          {
  460.             var _loc10_ = _root.advanceDir != "L" ? "L" : "R";
  461.             if(this.dirArray[_loc9_] != _loc10_)
  462.             {
  463.                _loc7_.push(this.dirArray[_loc9_]);
  464.             }
  465.          }
  466.          _loc9_ = _loc9_ + 1;
  467.       }
  468.       _loc9_ = 0;
  469.       _loc11_ = _loc7_.length;
  470.       if(_loc9_ < _loc11_)
  471.       {
  472.          if(_loc7_[_loc9_] == _root.advanceDir)
  473.          {
  474.             return _root.advanceDir;
  475.          }
  476.          return _loc7_[random(_loc7_.length)];
  477.       }
  478.    }
  479.    function attacking()
  480.    {
  481.       this.xMovT *= 1.03;
  482.       this.yMovT *= 1.03;
  483.    }
  484.    function death()
  485.    {
  486.       _root.stats.score += 3500;
  487.       _root.stats.destroyed = _root.stats.destroyed + 1;
  488.       _root.powerUp(this.x,this.y,95);
  489.       if(this.matrixVar == 1)
  490.       {
  491.          _root.matrixNum = _root.matrixNum + 1;
  492.          if(_root.matrixNum >= _root.matrixSize)
  493.          {
  494.             _root.matrixComplete = true;
  495.          }
  496.       }
  497.       var _loc3_ = 0;
  498.       var _loc4_ = _root["form" + this.form[0]].length;
  499.       while(_loc3_ < _loc4_)
  500.       {
  501.          if(_root["form" + this.form[0]][_loc3_] == "bugB" + this.id)
  502.          {
  503.             _root["form" + this.form[0]].splice(_loc3_,1);
  504.             if(_root["form" + this.form[0]].length == 0)
  505.             {
  506.                delete _root["form" + this.form[0]];
  507.                if(_root["formB" + this.form[0]] == "matrixed")
  508.                {
  509.                   _root.createPowerUp([this.x,this.y,"coin5"]);
  510.                   _loc3_ = 0;
  511.                   _loc4_ = random(3) + 1;
  512.                   while(_loc3_ < _loc4_)
  513.                   {
  514.                      _root.createPowerUp([this.x,this.y,"coin5"]);
  515.                      _loc3_ = _loc3_ + 1;
  516.                   }
  517.                   _root.stats.score += 3500;
  518.                }
  519.                else
  520.                {
  521.                   _loc3_ = 0;
  522.                   _loc4_ = random(3) + 1;
  523.                   while(_loc3_ < _loc4_)
  524.                   {
  525.                      _root.createPowerUp([this.x,this.y,"coin5"]);
  526.                      _loc3_ = _loc3_ + 1;
  527.                   }
  528.                   _root.stats.score += 7000;
  529.                }
  530.                delete _root["formB" + this.form[0]];
  531.             }
  532.             break;
  533.          }
  534.          _loc3_ = _loc3_ + 1;
  535.       }
  536.       _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(80,130),_root.randRange(75,100),"Blue"]);
  537.       _root.audio.playLevel4("bugX" + (random(4) + 1),_root.randRange(7,17));
  538.       var _loc5_ = 0;
  539.       var _loc6_ = random(3);
  540.       while(_loc5_ < _loc6_)
  541.       {
  542.          _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"bugB","Blue"]);
  543.          _loc5_ = _loc5_ + 1;
  544.       }
  545.       _root.createEnemySoul([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"blue"]);
  546.       _root.removeChar("bugB" + this.id);
  547.       this.f2 = "";
  548.    }
  549.    function advance()
  550.    {
  551.       this.dir = _root.advanceDir;
  552.       this.clip.body.flame.gotoAndPlay("advance");
  553.       this.xMovT = _root.advanceDir != "L" ? 1 * (this.speed / 2) : -1 * (this.speed / 2);
  554.       this.f2 = "advancing";
  555.    }
  556.    function advancing()
  557.    {
  558.       this.c = this.c + 1;
  559.       if(this.c > this.advanceMax)
  560.       {
  561.          this.xMovT = 0;
  562.          this.c = 0;
  563.          this.f2 = "wait";
  564.          _root.d = _root.d + 1;
  565.          _root.attachMovie("sight","sightClip",_root.d);
  566.          _root.sightClip.gotoAndStop("hindSight");
  567.          _root.sightClip._x = this.x;
  568.          _root.sightClip._y = this.y;
  569.          if(_root.advanceDir == "L")
  570.          {
  571.             _root.sightClip._rotation = 180;
  572.          }
  573.          if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  574.          {
  575.             _root.broBehind();
  576.          }
  577.          removeMovieClip(_root.sightClip);
  578.       }
  579.    }
  580.    function wander()
  581.    {
  582.       if(random(100) > 98 + _root.dif.wander)
  583.       {
  584.          this[this.axis + "MovT"] = 0;
  585.          this.axis = this.axis != "x" ? "x" : "y";
  586.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  587.          this.getDirString();
  588.       }
  589.       if(random(100) > 97 + _root.dif.wander)
  590.       {
  591.          this.switchScope();
  592.       }
  593.    }
  594.    function death2()
  595.    {
  596.       _root.removeChar("bugB" + this.id);
  597.       this.f2 = "";
  598.    }
  599.    function main()
  600.    {
  601.       this[this.f2]();
  602.       if(this.oldDir != this.dir)
  603.       {
  604.          this.clip.gotoAndStop("fly" + this.dir);
  605.       }
  606.       this.oldDir = this.dir;
  607.       if(random(200) >= 199 + _root.dif.wander)
  608.       {
  609.          _root.d = _root.d + 1;
  610.          _root.attachMovie("feeler","feelerClip",_root.d);
  611.          if(this.dir == "L")
  612.          {
  613.             var _loc9_ = [-310,0,300,50];
  614.          }
  615.          else if(this.dir == "R")
  616.          {
  617.             _loc9_ = [50,0,300,50];
  618.          }
  619.          else if(this.dir == "U")
  620.          {
  621.             _loc9_ = [0,-310,50,300];
  622.          }
  623.          else
  624.          {
  625.             _loc9_ = [0,50,300,50];
  626.          }
  627.          _root.feelerClip._x = this.x + _loc9_[0];
  628.          _root.feelerClip._y = this.y + _loc9_[1];
  629.          _root.feelerClip._width = _loc9_[2];
  630.          _root.feelerClip._height = _loc9_[3];
  631.          var _loc4_ = 0;
  632.          var _loc8_ = _root.chars.length;
  633.          var _loc7_ = false;
  634.          while(_loc4_ < _loc8_)
  635.          {
  636.             var _loc6_ = _root.chars[_loc4_] + "Clip";
  637.             if(_root.feelerClip.hitTest(_root[_loc6_]))
  638.             {
  639.                var _loc3_ = _root.chars[_loc4_];
  640.                if(_root[_loc3_].Name.substr(0,3) != "bro")
  641.                {
  642.                   _loc7_ = true;
  643.                }
  644.             }
  645.             _loc4_ = _loc4_ + 1;
  646.          }
  647.          removeMovieClip(_root.feelerClip);
  648.          if(!_loc7_)
  649.          {
  650.             _root.d = _root.d + 1;
  651.             _root.attachMovie("sight","sightClip",_root.d);
  652.             _root.sightClip._x = this.x;
  653.             _root.sightClip._y = this.y;
  654.             if(this.dir == "U")
  655.             {
  656.                _root.sightClip._rotation = 90;
  657.             }
  658.             else if(this.dir == "R")
  659.             {
  660.                _root.sightClip._rotation = 180;
  661.             }
  662.             else if(this.dir == "D")
  663.             {
  664.                _root.sightClip._rotation = -90;
  665.             }
  666.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  667.             {
  668.                this.clip.body.charger.gotoAndPlay("fire");
  669.                this.clip.body.eye1.gotoAndPlay("fire");
  670.                this.clip.body.eye2.gotoAndPlay("fire");
  671.                this.clip.body.eye3.gotoAndPlay("fire");
  672.                this.firing = true;
  673.                this.fc = 0;
  674.             }
  675.             removeMovieClip(_root.sightClip);
  676.          }
  677.       }
  678.       if(this.firing)
  679.       {
  680.          this.fc = this.fc + 1;
  681.          if(this.fc == 5)
  682.          {
  683.             if(this.dir == "L")
  684.             {
  685.                var _loc11_ = this.x - 24;
  686.                var _loc13_ = this.y + 12;
  687.                var _loc14_ = this.x - 24;
  688.                var _loc12_ = this.y + 6;
  689.             }
  690.             else if(this.dir == "R")
  691.             {
  692.                _loc11_ = this.x + 9;
  693.                _loc13_ = this.y + 12;
  694.                _loc14_ = this.x + 9;
  695.                _loc12_ = this.y + 6;
  696.             }
  697.             else if(this.dir == "U")
  698.             {
  699.                _loc11_ = this.x + 12;
  700.                _loc13_ = this.y - 24;
  701.                _loc14_ = this.x + 6;
  702.                _loc12_ = this.y - 24;
  703.             }
  704.             else
  705.             {
  706.                _loc11_ = this.x + 12;
  707.                _loc13_ = this.y + 3;
  708.                _loc14_ = this.x + 6;
  709.                _loc12_ = this.y + 3;
  710.             }
  711.             _root.enemyShotID = _root.enemyShotID + 1;
  712.             _root["bugBFireA" + _root.enemyShotID] = new classes.shots.BugBFireA(_loc11_,_loc13_,this.dir,_root.enemyShotID);
  713.             _root.addEnemyShot("bugBFireA" + _root.enemyShotID);
  714.             _root.enemyShotID = _root.enemyShotID + 1;
  715.             _root["bugBFireB" + _root.enemyShotID] = new classes.shots.BugBFireB(_loc14_,_loc12_,this.dir,_root.enemyShotID);
  716.             _root.addEnemyShot("bugBFireB" + _root.enemyShotID);
  717.             _root.audio.playLevel3("bugBFire",_root.randRange(15,25));
  718.          }
  719.       }
  720.       if(this.nudging)
  721.       {
  722.          this.xA *= 0.5;
  723.          this.yA *= 0.5;
  724.          this.nc = this.nc + 1;
  725.          var _loc10_ = 255 - this.nc * 17;
  726.          this.colorTrans.redOffset = _loc10_;
  727.          this.colorTrans.greenOffset = _loc10_;
  728.          this.trans.colorTransform = this.colorTrans;
  729.          if(this.nc == 15)
  730.          {
  731.             this.xA = this.yA = 0;
  732.             this.nudging = false;
  733.             this.colorTrans.redOffset = this.colorR;
  734.             this.colorTrans.greenOffset = this.colorR;
  735.             this.trans.colorTransform = this.colorTrans;
  736.          }
  737.       }
  738.       _loc4_ = 0;
  739.       _loc8_ = _root.broShots.length;
  740.       while(_loc4_ < _loc8_)
  741.       {
  742.          _loc6_ = _root.broShots[_loc4_] + "Clip";
  743.          if(this.clip.hitTest(_root[_loc6_]))
  744.          {
  745.             _loc3_ = _root.broShots[_loc4_];
  746.             var _loc5_ = this.life;
  747.             this.life -= _root[_loc3_].power;
  748.             if(this.life < 1)
  749.             {
  750.                this.f2 = "death";
  751.             }
  752.             else
  753.             {
  754.                this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,5);
  755.                _root.audio.playLevel4("bugHit" + (random(4) + 1),_root.randRange(7,15));
  756.             }
  757.             _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
  758.             _root[_loc3_].exploX = this.x + this.clip._width / 2;
  759.             _root[_loc3_].exploY = this.y + this.clip._height / 2;
  760.             _root[_loc3_].hit(_loc5_);
  761.             break;
  762.          }
  763.          _loc4_ = _loc4_ + 1;
  764.       }
  765.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  766.       {
  767.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  768.          this.f2 = "death";
  769.       }
  770.       if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
  771.       {
  772.          delete _root["form" + this.form[0]];
  773.          delete _root["formB" + this.form[0]];
  774.          this.f2 = "death2";
  775.       }
  776.       if(this.xMovT < this.xMov)
  777.       {
  778.          this.xMov -= 1;
  779.       }
  780.       else if(this.xMovT > this.xMov)
  781.       {
  782.          this.xMov += 1;
  783.       }
  784.       else
  785.       {
  786.          this.xMov = this.xMovT;
  787.       }
  788.       if(this.yMovT < this.yMov)
  789.       {
  790.          this.yMov -= 1;
  791.       }
  792.       else if(this.yMovT > this.yMov)
  793.       {
  794.          this.yMov += 1;
  795.       }
  796.       else
  797.       {
  798.          this.yMov = this.yMovT;
  799.       }
  800.       this.x += this.xMov + this.xA;
  801.       this.y += this.yMov + this.yA;
  802.       this.clip._x = this.x;
  803.       this.clip._y = this.y;
  804.    }
  805. }
  806.